#ifndef _IO_H_
#define _IO_H_

#define outb(value, port) \
	__asm__("outb %%al, %%dx\n\t" \
			::"a"(value), "d"(port))
#define outb_p(value, port) \
	__asm__("outb %%al, %%dx\n\t" \
			".word 0x00eb, 0x00eb\n\t" \
			::"a"(value), "d"(port))

#define inb(port) ({ \
	unsigned char value; \
	__asm__ volatile ("inb %%dx, %%al\n\t"\
			:"=a"(value) \
			:"d"(port)); \
	value; \
	})

#define inb_p(port) ({ \
	unsigned char value; \
	__asm__ volatile ("inb %%dx, %%al\n\t" \
					  ".word 0x00eb, 0x00eb\n\t" \
			:"=a"(value) \
			:"d"(port)); \
	value; \
	})

#define CMOS_READ(addr) ({\
		outb_p(addr, 0x70); \
		intb_p(0x71); \
		})

#endif
